import request from '../utils/request';
import constant from '../constant/constant'
import qs from 'qs';

/**
 * 用户登录
 */
export function login(payload){
    let option = {
        method: 'POST',
        body: qs.stringify(payload),
        headers: {
		    "Content-Type": "application/x-www-form-urlencoded"
		},
		mode: "cors",
    } 
    return request(constant.serverUrl+'/tvs/api/users/login',option)
}

/**
 * 用户注册
 */
export function register(payload){
    let option = {
        method: 'POST',
        body: qs.stringify(payload),
        headers: {
		    "Content-Type": "application/x-www-form-urlencoded"
		},
		mode: "cors",
    }

    return request(constant.serverUrl+'/tvs/api/users/create',option)
}

/**
 * 用户注销
 */
export function deleteUser(payload){
    let option = {
        method: 'POST',
        body: qs.stringify(payload),
        headers: {
		    "Content-Type": "application/x-www-form-urlencoded"
		},
		mode: "cors",
    }

    return request(constant.serverUrl+'/tvs/api/users/administrators/deleteuser/byid',option)
}